package com.wyd.sort;

public class InsertSort  implements  SortInterface{
    @Override
    public int[] sort(int[] sorts) {

        for (int i = 1; i < sorts.length; i++) {
            int tmp = sorts[i];
            int j = i;
            for (; j >0 ; j--) {
                if (tmp >= sorts[j-1]){
                    break;
                }
                sorts[j] = sorts[j-1];
            }
            if (j != i){
                sorts[j] = tmp;
            }
        }
        return sorts;
    }
}
